<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form>
    <div class="input-group">
        <span class="input-group-addon">房间名称</span>
        <input type="text" class="form-control"id="name" placeholder="房间名称">
    </div>
    <div class="input-group">
        <span class="input-group-addon">房间号码</span>
        <input type="text" class="form-control" id="room_number" placeholder="房间号码">
    </div>
    <div class="input-group">
        <span class="input-group-addon">房间价格</span>
        <input type="text" class="form-control" id="price" placeholder="房间价格">
    </div>
    <div style="text-align: center;margin-top: 10px;">
        <button class="btn btn-primary" type="button" onclick="add_house()">添加房间</button>
    </div>

</form>
</body>
<script>
    function add_house(){
        $.ajax({
            type:"post",
            url: "{:url('admin/system/add_house')}",
            data: {
                name:$('#name').val(),
                room_number:$('#room_number').val(),
                price:$('#price').val()
            },
            //回调函数
            success: function(data){
//                console.log(data);
                if(data.code == 100){
                    alert(data.msg);
                    window.location.reload();
                }else{
                    alert(data.msg);
                }
            }});
    }
</script>
</html>